/*
**			Heroes IV
**	  Copyright 2001, The 3DO Company
**
** creature_info_window.h
**
*/

#ifndef CREATURE_INFO_WINDOW_H_INCLUDED
#define CREATURE_INFO_WINDOW_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "bitmap_group_ptr.h"
#include "bitmap_layer_ptr.h"
#include "bitmap_layer_window.h"
#include "bitmap_layer_cache_window_ptr.h"
#include "button_ptr.h"
#include "creature_array.h"
#include "creature_array_window.h"
#include "game_window.h"
#include "handler.h"
#include "skill.h"
#include "text_window_ptr.h"

// ---------------------------------------------------------------------------
// window for displaying and manipulating lists of creatures
// ---------------------------------------------------------------------------
class t_creature_info_window;
class t_army_info_window;

typedef t_handler_2<t_creature_info_window*, int> t_creature_info_handler;

class t_creature_info_window : public t_window
{
public:
	enum t_layout
	{
		k_single_row,
		k_top_row,
		k_bottom_row,
		k_stacked_rows
	};

	t_creature_info_window( t_screen_point const& point, 
		                     t_creature_array const * army,
                             t_skill_mastery scout_skill_level,
							 t_layout layout, t_window* parent );

	void						changed();
	t_creature_array const *	get_army();
	int							get_frame_height() const;
    t_creature_stack const *	get_selected_army();
	int							get_selected_slot() const;
	void						select_creature( int index );
	void						select_first();
	void						set_army( t_creature_array const * army );
	void						set_change_handler( t_handler handler );
	//void						set_double_click_handler( t_creature_select_handler handler );
	void						set_graveyard( bool arg );
	void						set_highlight( int index, bool highlight );
	void						set_scouting_level( t_skill_mastery scout_skill_level );
	void			            set_select_handler( t_creature_info_handler handler );

	void						update();
protected:
	enum { k_number_of_creature_portraits = t_creature_array::k_size };

	struct t_creature_portrait_window
	{
		t_bitmap_layer_cache_window_ptr portrait_window;
		t_bitmap_window_ptr				border;
		t_bitmap_window_ptr				selected;
		t_text_window_ptr				text;
		t_text_window_ptr				quantity_text;
	};


    t_creature_array const *    m_army;
    t_mouse_window_ptr		    m_divide_cursor;
    t_bitmap_group_ptr		    m_divide_image;
    //t_creature_select_handler m_double_click_handler;
    t_bitmap_group_ptr          m_hero_portraits;
    t_bitmap_group_ptr          m_rings;
	t_creature_info_handler     m_select_handler;
	int                         m_selected_slot;
    t_skill_mastery             m_scouting_skill_level;

	t_creature_portrait_window m_portrait_slots[k_number_of_creature_portraits];
};

inline void t_creature_info_window::changed()
{
}

inline t_creature_array const * t_creature_info_window::get_army()
{
	return m_army;
}

inline void t_creature_info_window::set_change_handler( t_handler handler )
{
}

//inline 
//void t_creature_info_window::set_double_click_handler( t_creature_select_handler handler )
//{
//	m_double_click_handler = handler;
//}

inline void t_creature_info_window::set_select_handler( t_creature_info_handler handler )
{
	m_select_handler = handler;
}

inline int t_creature_info_window::get_selected_slot() const
{
	return m_selected_slot;
}

#endif // CREATURE_INFO_WINDOW_H_INCLUDED
